package com.Controller;

import com.Service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/category")
public class GroupCategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/list")
    public String listAll(Model model) {
        model.addAttribute("categories", categoryService.findAll());
        return "category_list";
    }
}
